package com.xyazm.order.remote;

import com.xyazm.common.core.JsonResult;
import com.xyazm.common.utils.CheckResultUtil;
import com.xyazm.market.api.IMarketApi;
import com.xyazm.market.domain.dto.CalculateOrderAmountDTO;
import com.xyazm.market.domain.param.CalculateOrderAmountParam;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;

/**
 * 营销服务远程调用接口
 * @author xuyou
 * @date 2022年08月26日 21:37
 */
@Component
public class MarketRemote {


    /**
     * 营销服务
     */
    @DubboReference(version = "1.0.0")
    private IMarketApi marketApi;

    public CalculateOrderAmountDTO calculateOrderAmount(CalculateOrderAmountParam calculateOrderAmountParam) {
        JsonResult<CalculateOrderAmountDTO> jsonResult = marketApi.calculateOrderAmount(calculateOrderAmountParam);
        CheckResultUtil.checkResult(jsonResult,"计算订单费用");
        return jsonResult.getData();
    }


}
